<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://www.yaodian100.com/jsp/yaodian100" prefix="yaodian100" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@page import="com.yaodian100.core.common.utils.ServerValue"%>
<c-rt:set var="midContextPath" value='<%=ServerValue.getMidContextPath() %>'/>
<!-- 月历 -->
<script type="text/javascript" charset="UTF-8" src="/js/jquery.datepick.js"></script>
<script type="text/javascript" charset="UTF-8" src="/js/jquery.datepick-zh-CN.js"></script>
<link rel="stylesheet" type="text/css" href="/css/smoothness.datepick.css" />
<script language="javascript">
	$().ready( function() {
		$('#startDateParam').datepick({showOn:'both',numberOfMonths:2, buttonImageOnly: true, buttonImage: '/images/calendar.gif',dateFormat:"yy-mm-dd"}); 
		$('#endDateParam').datepick({showOn: 'both',numberOfMonths:2, buttonImageOnly: true, buttonImage: '/images/calendar.gif',dateFormat:"yy-mm-dd"});
	});
</script>
<style type="text/css">
	.bg-active {
		background: #D4FAED;
	}
</style>
<h1>馆首页 - 广告管理(PM)<br/>
	<div class="f-link">
		<a href="${midContextPath}/generate/addAdvGuan.do">新增馆首页广告</a>
	</div>
</h1>
<div class="data-form"><s:form action="search.do" method="post">
	<b>广告名称：</b>
	<input name="advNameParam" type="text" id="advNameParam"
		value="${advNameParam}" size="20" maxlength="20">
	<b>起迄时间：</b>
	<input name="startDateParam" type="text" id="startDateParam"
		value="${startDateParam}" size="10" maxlength="10">
    ~ <input name="endDateParam" type="text" id="endDateParam"
		value="${endDateParam}" size="10" maxlength="10">
	<BR>
	状态：<s:select name="advStatusParam" value="%{advStatusParam}" headerKey="" headerValue="全部"
		list="advStatusMenu.options" listKey="key" listValue="value.name" />
	类型：<s:select name="advTypeParam" value="%{advTypeParam}" 
		list="advTypeMenu.options" listKey="key" listValue="value.name" />
	馆别：<s:select name="categoryRootParam" value="%{categoryRootParam}" headerKey="" headerValue="全部"
		list="categoryRoot" listKey="id" listValue="name" />		
	<input type="button" value="搜寻" onClick="this.form.submit();" />
</s:form></div>
<br />
<table class="tb-1"  width="100%">
	<thead>
		<tr>
			<th>#</th>
			<th>名称</th>
			<th>起迄时间</th>
			<th>状态</th>
			<th>类型</th>
			<th>剩几天到期</th>
			<th>最后更新日期</th>
			<th>管理</th>
		</tr>
	</thead>
	<tbody>
		<c-rt:forEach items="${viewPmAdvertises}" var="advertise" varStatus="rows_index">
			<s:if test=""></s:if>
			<c-rt:choose>
				<c-rt:when test="${advertise.advStatus == '20'}">
					<c-rt:set var="trClass" value="bg-active"></c-rt:set>
				</c-rt:when>
				<c-rt:otherwise>
					<c-rt:set var="trClass" value="${rows_index.count % 2 == 0 ? 'bg-yl' : ''}"></c-rt:set>
				</c-rt:otherwise>
			</c-rt:choose>
			<tr class="${trClass}">
				<td>${rows_index.count}</td>
				<td>${advertise.advName}</td>
				<td>
					<fmt:formatDate value="${advertise.startDate}" pattern="yyyy-MM-dd HH:mm"/> ~ 
					<fmt:formatDate value="${advertise.endDate}" pattern="yyyy-MM-dd HH:mm"/>
				</td>
				<td>
					<c-rt:choose>
						<c-rt:when test="${advertise.advStatus == '90'}">
							<span class="txt-rd">
								${advStatusMenu.options[advertise.advStatus].name}
							</span>
						</c-rt:when>
						<c-rt:otherwise>
							${advStatusMenu.options[advertise.advStatus].name}
						</c-rt:otherwise>
					</c-rt:choose>
				</td>
				<td>${advTypeMenu.options[advertise.advType].name}</td>
				<td>
					<c-rt:choose>
						<c-rt:when test="${advertise.yetPromo < 0 and advertise.startPromo > 0}">未开始</c-rt:when>
						<c-rt:when test="${advertise.yetPromo > 0 and advertise.startPromo < 0}">已到期</c-rt:when>
						<c-rt:otherwise>${advertise.startPromo}</c-rt:otherwise>
					</c-rt:choose>
				</td>
				<td><fmt:formatDate value="${advertise.modifyDate}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
				<td>
					<c-rt:choose>
						<c-rt:when test="${advertise.advType eq '000_PROMOTION' or advertise.advType eq '100_PROMOTION'}">
							<a href="${midContextPath}/generate/cateMainProd/editCateMainProdAdv.do?advId=${advertise.id}">修改内容</a>
						</c-rt:when>
						<c-rt:when test="${advertise.advType eq '000_BANNER' or advertise.advType eq '100_BANNER'}">
							<a href="${midContextPath}/generate/cateMainProd/editCateBannerAdv.do?advId=${advertise.id}">修改内容</a>
						</c-rt:when>
						<c-rt:when test="${advertise.advType eq '000_MAINGOLD' or advertise.advType eq '100_MAINGOLD'}">
							<a href="${midContextPath}/generate/mainGold/editMainGoldAdv.do?advId=${advertise.id}">修改内容</a>
						</c-rt:when>
						<c-rt:when test="${advertise.advType eq '000_RDADV' or advertise.advType eq '100_RDADV'}">
							<a href="${midContextPath}/generate/infoBroadcast/editInfoBroadcastAdv.do?advId=${advertise.id}">修改内容</a>
						</c-rt:when>
						<c-rt:when test="${advertise.advType eq '000_HOTSELECT'}">
							<a href="${midContextPath}/generate/hotSelect/editHotSelectAdv.do?advId=${advertise.id}">修改内容</a>
						</c-rt:when>
						<c-rt:when test="${advertise.advType eq '000_SPECIALACT'}">
							<a href="${midContextPath}/generate/specialAct/editSpecialActAdv.do?advId=${advertise.id}">修改内容</a>
						</c-rt:when>
						<c-rt:when test="${advertise.advType eq '000_MAINGOLD_V2'}">
							<a href="${midContextPath}/generate/mainGold/editCateMainGoldAdv.do?advId=${advertise.id}">修改内容</a>
						</c-rt:when>
						<c-rt:when test="${advertise.advType eq 'OUTLETS_BANNER'}">
							<a href="${midContextPath}/generate/mainGold/editOutletsBannerAdv.do?advId=${advertise.id}">修改内容</a>
						</c-rt:when>
					</c-rt:choose>
				</td>
			</tr>
		</c-rt:forEach>
	</tbody>
</table>
<yaodian100:pageutil link="${midContextPath}/generate/search.do" pagerObj="${pager}" />